package com.higgins.lawapp.client.settings.panels;

import java.util.ArrayList;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.user.client.ui.DockLayoutPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.LayoutPanel;
import com.higgins.lawapp.client.settings.components.NameField;
import com.higgins.lawapp.client.settings.components.URLField;
import com.higgins.lawapp.client.settings.model.DataSourceModel;
import com.higgins.lawapp.client.settings.presenter.DataSourcePresenter;


public class FieldPanel extends LayoutPanel 	{
	//private final ResearchServiceAsync researchService = GWT.create(ResearchService.class);	
    final DockLayoutPanel topLevelPanel = new DockLayoutPanel(Unit.EM);
    private DataSourceModel dataSourceModel;
    private DataSourcePresenter dataSourcePresenter;
//    private ArrayList<LayoutPanel> panelList = new ArrayList<LayoutPanel>();
//    private ArrayList<String> panelTypeList = new ArrayList<String>();
//    public Label errorLabel = new Label();
    
	public FieldPanel(DataSourceModel dataSourceModel, DataSourcePresenter dataSourcePresenter)	{
		super();
		initialise();
		this.dataSourceModel = dataSourceModel;
		this.dataSourcePresenter = dataSourcePresenter;
//		dataSourcePresenter.setErrorLabel(errorLabel);
	}
	private void initialise()	{
		setWidth("800px");
		setHeight("1200px");
		topLevelPanel.setWidth("800px");
//		topLevelPanel.addSouth(errorLabel, 5);
		add(topLevelPanel);
	}
//	public void addDataSourceField(String fieldName, String fieldText)	{
//		final LayoutPanel dataSourceField = new DataSourceField(fieldName, fieldText, errorLabel, dataSourceModel);
//	    topLevelPanel.addNorth(dataSourceField, 2);
//	}
//	public void addURLField(String fieldName, String fieldText)	{
//	    final LayoutPanel urlField = new URLField(fieldName, fieldText);
//	    topLevelPanel.addNorth(urlField, 2);
//	}
//	public void addButtons()	{
//		ButtonsPanel buttonsPanel = new ButtonsPanel(this, dataSourceModel, topLevelPanel, panelList, panelTypeList);
//	    final LayoutPanel newFieldLayoutPanel = buttonsPanel;
//	    topLevelPanel.addNorth(newFieldLayoutPanel, 2);
//	}
//	public void addFlexTable()	{
//	    final LayoutPanel lawFirmTable = new LawFirmTable(dataSourceModel);
//	    topLevelPanel.addNorth(lawFirmTable, 20);
//    }
//	public String getError()	{
//		return errorLabel.getText();
//	}
//	public void setError(String error)	{
//		errorLabel.setText(error);
//	}
}
